package client.comm.baoding.ui

import client.comm.baoding.BaseMiddleActivity
import client.comm.baoding.R
import client.comm.baoding.adapter.page.MxjlFragmentPageAdapter
import client.comm.baoding.databinding.ActivityMxjlBinding
import client.comm.baoding.ui.vm.ZcjlViewModel

/**
 * 明细记录
 */
class MxJlActivity : BaseMiddleActivity<ZcjlViewModel, ActivityMxjlBinding>() {
    override fun getLayout(): Int {
        return R.layout.activity_mxjl
    }

    val adapter: MxjlFragmentPageAdapter by lazy {
        MxjlFragmentPageAdapter(supportFragmentManager)
    }

    override fun initViewModel(): ZcjlViewModel = createViewModel()

    override fun initView() {
        binding.event = this
        binding.viewPager.adapter = adapter
        binding.tabLayout.setupWithViewPager(binding.viewPager)
        when (intent.getIntExtra("index", 0)) {
            0 -> {
//                binding.tabWrap.getChildAt(0).isSelected = true
            }
            1 -> {
                binding.viewPager.postDelayed({
                    binding.viewPager.setCurrentItem(1, false)
                }, 20)
            }
            2 -> {
                binding.viewPager.postDelayed({
                    binding.viewPager.setCurrentItem(2, false)
                }, 20)
            }
        }

    }

}